package Dominion;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.mysql.jdbc.Statement;


import Persistence.Agent;

public class Test{
	
	public static void main(String [] args){
		//First, we must create (or get) an Agent
		Agent ag = Agent.getDbCon(); 
		ResultSet r;
		
		try {
			//Second, make a query
			//r = ag.query("Select * from ArticleReview WHERE idArticulo=?");
			Reviewer n = new Reviewer();
			n.setEmail("1@revisor.com");
			r= ag.get_resolved_publications(n);
			//Third, show data
			showQuery(r);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//Finally, we must close
		// TODO	
		
	}
	
	
	protected static void showQuery(ResultSet rs) throws SQLException {

		
		int columns = rs.getMetaData().getColumnCount();
		System.out.println("------------------------\n");

		while (rs.next()) {
			for (int i = 1; i <= columns; i++) {
				System.out.println(rs.getString(i));
			}
			System.out.println();
		}
		rs.close();

		System.out.println("------------------------");
		System.out.flush();
		}

}